﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;
/// <summary>
/// TLogRelationship 的摘要说明
/// </summary>
public class TLogRelationship
{
    //常量
  	const string CTableName="t_log_relationship";
  	const string CKeyName="";
    //与数据表字段对应的变量

    private string FLog_Id;
    private string FFriend_Id;
    private int FStatus;
    private decimal FSortNum;
    private string FInMan;
    private DateTime FInTime;
    private int FIId; 


	public TLogRelationship()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//

       
	}

    public void Select(string logid,string friendid)
    {
    	string strSql="select * from t_log_relationship where log_id='" + logid +"' and friend_id='" + friendid +"'";
    	TSqlDB oDB=new TSqlDB(strSql);
    	if(!oDB.EOF)
    	{
            FLog_Id = oDB["log_id"].ToString();
            FFriend_Id = oDB["friend_id"].ToString();
            FStatus = oDB["status"].ToInt();
            FSortNum = oDB["sortnum"].ToDecimal();
            FInMan = oDB["inman"].ToString();
            FInTime = oDB["intime"].ToDateTime();
            FIId = oDB["iid"].ToInt();
    	}
    	oDB.Free();
    }
    //插入新记录。
    public void Insert()
    {
        string ExSql = "insert into t_log_relationship values('" + FLog_Id + "','" + FFriend_Id + "','" + FStatus + "','" + FSortNum + "','" + FInMan + "','" + FInTime + "')";
    	TSqlDB.ExecuteNonQuery(ExSql);
    }
    //更新记录。
    public void Update(string logid, string friendid)
    {
        string ExSql = "update t_log_relationship set log_id ='" + FLog_Id + "', friend_id ='" + FFriend_Id + "', status ='" + FStatus + "', sortnum ='" + FSortNum + "', inman ='" + FInMan + "', intime ='" + FInTime + "' where log_id='" + logid + "' and friend_id='" + friendid + "'" ;
        TSqlDB.ExecuteNonQuery(ExSql);
    }
    //改变状态,0=未验证,1=已通过验证
    public void Update_status()
    {
        string ExSql = "status=" + FStatus.ToString(); ;
        //base.Update(ExSql);
    }
    //静态，可以不用创建对象即可调用。
    public static void DeleteByID(string logid, string friendid)
    {
        string ExSql="delete from t_log_relationship where log_id='" + logid + "' and friend_id='" + friendid + "'";
        TSqlDB.ExecuteNonQuery(ExSql);
    }

    public static void DeleteByLogId(string logid)
    {
        string ExSql = "delete from t_log_relationship where log_id='" + logid  + "'";
        TSqlDB.ExecuteNonQuery(ExSql);
    }
    
         
 
    public string Log_Id
    {
        get
        {
            return FLog_Id;
        }
        set
        {
            FLog_Id = value;
        }
    } 
    public string Friend_Id
    {
        get
        {
            return FFriend_Id;
        }
        set
        {
            FFriend_Id = value;
        }
    } 
    public int Status
    {
        get
        {
            return FStatus;
        }
        set
        {
            FStatus = value;
        }
    } 
    public decimal SortNum
    {
        get
        {
            return FSortNum;
        }
        set
        {
            FSortNum = value;
        }
    } 
    public string InMan
    {
        get
        {
            return FInMan;
        }
        set
        {
            FInMan = value;
        }
    } 
    public DateTime InTime
    {
        get
        {
            return FInTime;
        }
        set
        {
            FInTime = value;
        }
    } 
    public int IId
    {
        get
        {
            return FIId;
        }
        set
        {
            FIId = value;
        }
    }
}
